<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><style>#header + #content > #left > #rlblock_left,
#content > #right > .dose > .dosesingle,
#content > #center > .dose > .dosesingle
{display:none !important;}</style><style>img[src="http://s05.flagcounter.com/count/pTvk/bg=FFFFFF/txt=000000/border=CCCCCC/columns=6/maxflags=36/viewers=0/labels=0/"]
{display:none !important;}</style></head><body><h1>Subcircuits</h1>
You can use subcircuits to implement custom "black box" devices.
<p>
Create and test your device, and then use labeled nodes (under "Outputs and Labels") to mark and label all the inputs/outputs.  <a href="circuitjs.html?cct=$+1+0.000005+10.20027730826997+53+5+50%0Aw+304+64+304+128+0%0Ad+304+128+368+192+2+default%0Ad+304+256+368+192+2+default%0Ad+240+192+304+128+2+default%0Ad+240+192+304+256+2+default%0Aw+304+256+304+352+0%0Aw+368+192+416+192+0%0A207+304+64+304+16+4++in%5Cp%0A207+304+352+304+400+4++in-%0A207+416+192+480+192+4++out%5Cp%0A207+240+192+160+192+4++out-%0A">Here is an example circuit (a bridge rectifier).</a>
<p>
Then, select File->Create Subcircuit, then rearrange the pins the way you want them, enter a model name, and click OK.  This will load the subcircuit model.
Be sure to save this circuit (the subcircuit implementation), because it can't be edited later otherwise.
<p>
Now you can create a circuit using the subcircuit model.  Click with the right mouse and select the "Active Building Blocks" menu, and the "Add Subcircuit Instance" item.  Then click
and drag to create an instance.  Edit the instance to select which model you want (by default it will use the one you just created).
<p>
<a href="circuitjs.html?cct=$+1+0.000005+10.20027730826997+59+5+50%0A.+fullrect+0+2+2+4+in%5Cp+1+0+2+in-+3+1+2+out%5Cp+2+0+3+out-+4+1+3+DiodeElm%5Cs1%5Cs2%5CrDiodeElm%5Cs3%5Cs2%5CrDiodeElm%5Cs4%5Cs1%5CrDiodeElm%5Cs4%5Cs3+2%5C%5Csdefault%5Cs2%5C%5Csdefault%5Cs2%5C%5Csdefault%5Cs2%5C%5Csdefault%0A410+688+288+784+368+1+fullrect+2%5Csdefault+2%5Csdefault+2%5Csdefault+2%5Csdefault%0Aw+688+288+688+240+0%0Aw+688+320+688+368+0%0Aw+688+368+640+368+0%0Aw+688+240+640+240+0%0Av+640+368+640+240+0+1+40+5+0+0+0.5%0Aw+784+288+784+240+0%0Aw+784+320+784+368+0%0Aw+784+368+832+368+0%0Ar+832+240+832+368+0+1000%0Aw+784+240+832+240+0%0Ao+9+64+0+4099+5+0.025+0+2+9+3%0A">Here is an example using the rectifier.</a>  When you save/load this circuit, it will also save/load the subcircuit model so you can use it in other circuits.
<p>
You can also use subcircuits to rearrange pins on the built-in chips.  <a href="circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+50%0A165+800+368+848+368+6+0%0A207+864+336+864+288+0+Vin%0A207+800+400+752+400+0+dis%0A207+800+464+736+464+0+tr%0A207+800+496+736+496+0+th%0A207+864+528+864+592+0+ctl%0A207+896+528+896+592+0+gnd%0A207+928+432+992+432+0+out%0A207+928+400+992+400+0+rst%0A">Here is an example with the 555</a>.  And <a href="circuitjs.html?cct=$+1+0.000005+5.023272298708815+64+7+50%0Aw+112+192+112+224+0%0Aw+112+224+176+224+0%0Ac+112+224+112+288+0+3e-7+6.326871610496845%0Ag+112+288+112+304+0%0Ar+112+192+112+64+0+1000000%0Aw+112+64+240+64+0%0AR+112+64+80+64+0+0+40+10+0+0+0.5%0AO+352+160+416+160+0%0Aw+240+64+304+64+0%0Aw+304+64+304+128+0%0Aw+352+160+352+32+0%0Ar+352+32+160+32+0+10000%0Aw+160+32+160+96+0%0Aw+112+192+160+192+0%0A.+555+0+2+4+8+ctl+5+3+3+dis+1+1+3+gnd+8+0+2+out+6+2+2+rst+7+3+2+th+3+2+3+tr+2+1+2+Vin+4+0+3+TimerElm%5Cs1%5Cs2%5Cs3%5Cs4%5Cs5%5Cs6%5Cs7%5Cs8+6%5C%5Cs0%0A410+208+128+224+160+1+555+6%5Cs9.999632723888661%0Aw+304+128+336+128+0%0Aw+336+128+336+272+0%0Aw+336+272+208+272+0%0Aw+160+192+176+192+0%0Aw+176+192+176+160+0%0Aw+176+160+208+160+0%0Aw+208+192+192+192+0%0Aw+176+224+176+288+0%0Aw+176+288+320+288+0%0Aw+320+288+320+192+0%0Aw+320+192+304+192+0%0Aw+160+96+160+192+0%0Aw+160+96+320+96+0%0Ag+208+128+208+144+0%0Aw+208+224+208+272+0%0Aw+192+192+192+320+0%0Aw+192+320+352+320+0%0Aw+352+320+352+160+0%0Ao+2+32+0+4099+10+0.00078125+0+2+2+3%0Ao+7+16+0+4106+10+0.00009765625+1+1%0A">here is that subcircuit model being used in a circuit.</a>
<p>
If you select part of a circuit before using File->Create Subcircuit, then only the selected elements will be considered part of
the subcircuit.
<p>
If you want to use labeled nodes in the subcircuit definition but don't want them to be one of the inputs/outputs, then check the "Internal Node"
checkbox in those labeled nodes' edit menus.
</body></html>
